<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/base_user.css">
    <script src="__STATIC__/js/jquery-1.8.2.js"></script>
    <title>退换货</title>
    <script>
        $(function () {
            var h=$(".photo li").width();
            $(".fileInputContainer").css({height:h+"px"});
            $(".fileInput").css({height:h+"px"});
        })
    </script>
    <style>
        .tips{
            width: 94%;
            float: left;
            padding: 2% 3%;
            border-top: 1px solid #F0F0F0;
            background: white;
        }
        .tips span{
            float: right;
            display: block;
            font-size: 14px;
            line-height: 2;
            border: 1px solid #E73F09;
            width: 30%;
            text-align: center;
            border-radius: 4px;
            margin-left: 2%;
        }
        .wrap-log .tabcon>div {
            display: block;
        }
    </style>

</head>
{include file="public/href" /}
<body>
<div class="wrap-log">
    <div class="header">
        <p>退换货</p>
        <a href="{:url('mobile/user_info/member_order')}?status={:input('status','all')}">
            <img src="__STATIC__/img/back.png" class="back" >
        </a>
    </div>
    <div class="tablist">
        <ul>
            <li {eq name='$Request.action' value="return_money" }class="cur"{/eq}>
            <a href="{:url('member_order/return_money')}?status={:input('status','all')}&order_id={:input('order_id')}">申请退换货</a>
            </li>
            <li {eq name='$Request.action' value="return_money_record" }class="cur"{/eq}>
            <a href="{:url('member_order/return_money_record')}?status={:input('status','all')}&order_id={:input('order_id')}">退换货记录</a>
            </li>
        </ul>
    </div>
    <div class="tabcon" id="content_list">

    </div>
</div>
{include file='public/src' /}
<script>
    //layer流加载
    layui.use('flow', function() {
        var $ = layui.jquery;
        var flow = layui.flow;
        flow.load({
            elem: '#content_list' //流加载容器
            ,isAuto:true
            ,isLazyimg:true
            ,done: function(page, next){ //执行下一页的回调
                var lis = [];
                $.ajax({
                    url:"{:url('mobile/member_order/return_money_record')}",
                    dataType:'json',
                    type:'post',
                    data:{'page':page},
                    success:function(t){
                        layui.each(t.data, function(index, item){
                            var text = '退款中';
                            var is_logistics = '';   //是否添加物流信息
                            if (item.memberOrder.status == 7){
                                text = '退款成功';
                                var logistics_url = "{:url('mobile/member_order/sent_logistics')}?rid="+item.id;
                                is_logistics = '<div class="tips" style="border-bottom: 1px solid #F0F0F0;margin-bottom: 1.5%"><span class="qx" ><a href="'+logistics_url+'" style="color: red;">填写物流信息</a></span></div>'
                            }
                            var goods_list = '';

                            if (item.goodsList){
                                for (var i=0; i<item.goodsList.length;i++){
                                    goods_list += '<div class="content"><div class="left"><img src="/'+item.goodsList[i].thumb_img+'"></div><div class="right">' +
                                    '<div class="title"><p>'+item.goodsList[i].title+'</p></div>' +
                                    '<p class="type">颜色分类：'+item.goodsList[i].attr+'<span>×1</span></p><div class="price"><div>￥'+item.goodsList[i].price+'</div>' +
                                    '<div><span>周周币</span><img src="__STATIC__/img/sy-qianbi.png"><font class="scale">'+item.goodsList[i].rebate_percentage+'%</font></div>' +
                                    '</div></div></div>';
                                }
                            }
                            lis.push('<div id="main" style="display: block;">' +
                                    '<h4><a href="javascript:jump_shop('+item.shop_id+');"><span>店铺名称: '+item.memberOrder.shop.title+' </span>' +
                                    '<img src="__STATIC__/img_user/next2.png"></a><span class="right1" onclick="jump_order_details('+item.memberOrder.id+')" ><font style="border-bottom: 1px solid #E73F09">'+text+'</font></span></h4>' +
                                    goods_list +
                                    '<div class="tuikuan"><p>实付:<span>￥'+item.memberOrder.price+'</span> 退款金额：<span>￥'+item.amount+'</span></p></div>' +
                                    is_logistics+
                                    '</div>');
                        });
                        next(lis.join(''), page < t.pages);
                    },
                    error:function(){
                        layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
                    }
                })
            }
        });
    });
    //跳转到店铺
    function jump_shop(id) {
        var url = "{:url('mobile/user_category/shop_index')}?shop_id="+id;
        sessionStorage.setItem('url_back',window.location.href);
        window.location.href = url;
    }
    //跳转到订单详情
    function jump_order_details(id){
        window.location.href = "{:url('mobile/user_info/member_order_details')}?order_id="+id;
    }
</script>
</body>
</html>